package com.hss.rxjava;


import com.hss.rxjava.bean.CheckVersion;
import com.hss.rxjava.bean.GoodsBean;
import com.hss.rxjava.bean.HealthInfoModel;
import com.hss.rxjava.bean.Login;
import com.hss.rxjava.bean.ResultUserCashInfo;
import com.hss.rxjava.bean.UploadImageModel;
import com.hss.rxjava.result.ResultListObject;
import com.hss.rxjava.result.ResultObject;

import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;
import retrofit2.http.Streaming;
import rx.Observable;

/**
 * Created by Administrator on 2016/12/4.
 */

public interface Api {

    @POST("rest/wonders/version/check")
     Call<ResultObject<CheckVersion>> versionCheck();

    @FormUrlEncoded
    @POST("rest/users/login")
    Observable<ResultObject<Login>> login(@Field("userName") String account,
                                          @Field("password") String pwd,
                                          @Field("appType") int appType,
                                          @Field("systemType") int systemType
                                          );
//@FieldMap HashMap<String,String> params

    @Streaming
//    @Multipart
    @POST("rest/users/headIcon")
    Observable<ResultObject<UploadImageModel>> UpdataHeadIcon(@Body RequestBody reqBody);
//    Call<ResultObject<UploadImageModel>> UpdataHeadIcon(@Part MultipartBody.Part file);

//    User updateUser(@Part("photo") TypedFile photo, @Part("description") TypedString description);

    @POST("rest/users/cashes")
    Observable<ResultObject<ResultUserCashInfo>> getUserCashInfo();

    @FormUrlEncoded
    @POST("rest/healthInfo/healthInfoList")
//    Call<ResultListObject<HealthInfoModel>> getHealthInfoList(@Header("token") String token,@Header("userId") String userId , @Field("currentPageNo") int currentPageNo, @Field("pageSize") int pageSize);
    Observable<ResultListObject<HealthInfoModel>> getHealthInfoList(@Field("currentPageNo") int currentPageNo,
                                                              @Field("pageSize") int pageSize);

//    @FormUrlEncoded
    @Streaming
    @POST("rest/pic/upload")
    Observable<ResultObject<String>> uploadImagesForClaim(@Body MultipartBody reqBody);
    //构建body
//    RequestBody requestBody = new MultipartBody.Builder().setType(MultipartBody.FORM)
//            .addFormDataPart("name", name)
//            .addFormDataPart("name", psd)
//            .addFormDataPart("file", file.getName(), RequestBody.create(MediaType.parse("image/*"), file))
//            .build();
//    MultipartBody.Builder reqBodyBuild = new   MultipartBody.Builder()
//            .setType(MultipartBody.FORM);
//    reqBodyBuild.addFormDataPart("imageType","医疗费用收据原件");
//    reqBodyBuild.addFormDataPart("applyType",String.valueOf(1));
//    reqBodyBuild.addFormDataPart( "files","06.jpg",RequestBody.create(Constants.MEDIA_TYPE_IMG,img1));
//    reqBodyBuild.addFormDataPart( "files","08.jpg",RequestBody.create(Constants.MEDIA_TYPE_IMG,img2));


    @FormUrlEncoded
    @POST("rest/wonders/goods/search")
    Observable<ResultListObject<GoodsBean>> goodsList(@Field("currentPageNo") int  pageNum,
                                                      @Field("pageSize") int pageSize,
                                                      @Field("typeId") String  typeId,
                                                      @Field("typeLevel") int typeLevel,
                                                      @Field("sort") int sort,
                                                      @Field("keyword") String  keyword   );
}
